package com.qingke.ssh.control;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.opensymphony.xwork2.ActionSupport;
import com.qingke.ssh.bean.Employee;
import com.qingke.ssh.dao.EmployeeDao;

@Controller
public class GetAllEmployee extends ActionSupport {
	@Autowired
	private EmployeeDao dao;
	private String result;

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String execute() throws Exception {
		System.out.println("123");
		List<Employee> employees = dao.getAllEmployee();
		Gson gson = new Gson();
		JsonObject
		result = gson.toJson(employees.toString());
		System.out.println(result);
		// result = "{\"name\":1234}";
		return "success";
	}
}
